
-- EliteMatchSeasonAwardView
--
local EliteMatchSeasonAwardRender = import(".renders.EliteMatchSeasonAwardRender")

local fileName = string.getModeName(...)
local ClassRef = class(fileName, app.mvc.ViewBase)

ClassRef.VIEW_ROOT_RES = Res.PvpChallengeRankAwardScene

function ClassRef:init()
	self._ui.Button_close:addClickEventListener(function()
		self:closeView()
	end)

	self._ui.tlt:setString(L("EliteMatchTip50"))
end

function ClassRef:updateViewByPlayId(playId)
	if not playId then return end
	if playId == Enums.TeamTarget.eliteMatchArena then
		self._ui.tips:setString(L("EliteMatchTip22"))
	elseif playId == Enums.TeamTarget.eliteMatchDuel then
		self._ui.tips:setString(L("EliteMatchTip51"))
	end
	local listView = self._ui.ListView
	listView:removeAllChildren()

	local conf = GD:getEliteMatchConfigById(playId)
	local length = #conf
	for i = 1, length do
		local render = EliteMatchSeasonAwardRender.create()
		local arrItems = UD:parseItemsFromString(conf[i].par, UD:getClass())
		render:setData({index = i, title = L(conf[i].thronePar), data = arrItems})
		listView:pushBackCustomItem(render)
	end
	listView:refreshView()
end

return ClassRef
